<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- 
    Document   : MODE_JSP
    Created on : 28 mars 2014, 12:26:51
    Author     : phinguyen
--%>
<jsp:useBean id="decision" scope="request" class="model.Decision" />

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="model.Docversion"%>
<%@page import="core.telechargertest"%>
<%@page import="model.Decision"%>
<%@page import="model.Employee"%>
<%@page import="core.StepOwnerCore"%>
<%@page import="model.Document"%>
<%@page import="java.util.ArrayList"%>
<%@page import="model.Docversion"%>
<%@page import="java.util.List"%>
<%@page import="core.telechargertest"%>
<html>
    <head>
        <title>detail decision </title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <!--specific Meta data to employee portal-->
        <meta name="Owner.corporateName" content="AIRBUS">
        <meta name="Aircraft.type" content="">
        <meta name="Aircraft.series" content="">
        <meta name="Aircraft.family" content="">
        <meta name="Rights" content="AIRBUS">
        <meta name="Type.category" content="eSite">
        <meta name="Type.aggregationLevel" content="collection">
        <meta name="Subject.keywords" content="">
        <meta name="Description" content="">
        <script language="JavaScript">
        </script>
        <link rel="stylesheet" href="css/ms-template.css" type="text/css">
    </head>

    <!-- !!! CSS du body  -->
    <body bgcolor="#FFFFFF" background="html/claflib/bgdefault.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('html/claflib/plugin_b.gif', 'html/claflib/contact_ro.gif', 'html/claflib/closeesite_ro.gif')">


        <!-- bande grise  -->

        <table width="100%" border="0" cellspacing="0" cellpadding="0" height="18" bgcolor="#B8B8B8">
            <tr> 
                <td class="arbo" width="25%" height="2"> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" height="11">
                        <tr> 
                            <td  width="10" height="2"><img src="html/claflib/pix_trans.gif" width="10" height="1"><a name="top"></a></td>
                            <td width="774" height="2" valign="center" class="arbo"><font color="#333333"><a href="index.html">Home</a></font></td>
                        </tr>
                    </table>
                </td>
                <td height="2" width="75%" class="text12blue"><div align="right" class="arbo"><script>document.write(messageDate);</script>&nbsp;</div></td>
            </tr>
        </table>

        <!-- fin bande grise  -->


        <!-- bande bleu avec image du header -->
        <table width="100%" height="51" border="0" cellpadding="0" cellspacing="0">
            <tr> 
                <td  class="bando" width="1028"><img src="html/claflib/banner/banner.gif" width="785" height="51"></td>
                <td class="bando"  width="19"></td>
                <td class="bando" width="82" valign="bottom"><table width="82" height="50" border="0" cellpadding="0" cellspacing="0">

                        <tr> 
                            <td height="25" valign="middle"><a href="#" onClick="self.close()"><img src="html/claflib/banner/closeesite.gif" name="close" width="80" height="14" border="0" id="close" onMouseOver="MM_swapImage('close', '', 'html/claflib/banner/closeesite_ro.gif', 1)" onMouseOut="MM_swapImgRestore()"></a></td>
                        </tr>
                        <tr> 
                            <td height="25" valign="middle"><a href="mailto:info@airbus.com"><img src="html/claflib/banner/contact.gif" name="contact" width="53" height="14" border="0" id="contact" onMouseOver="MM_swapImage('contact', '', 'html/claflib/banner/contact_ro.gif', 1)" onMouseOut="MM_swapImgRestore()"></a></td>
                        </tr>
                    </table></td>
                <td  class="bando" width="41"><img src="html/claflib/pix_trans.gif" width="1" height="1"></td>
            </tr>
            <tr> 
                <td colspan="4" bgcolor="#FFFFFF"><img src="html/claflib/pix_trans.gif" width="1" height="1"></td>
            </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr> 
                <td bgcolor="#333366"><img src="html/claflib/pix_trans.gif" width="1" height="1"></td>
            </tr>
        </table>
        <table width="00" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr> 
                <td valign="top" class="text12blue" align="left" colspan="3" height="90"> 
                    <br>

                    <div class="body">
                            <h1>Details on Decision : ${decision.dapversion}</h1>
                            <br>
                            <br>
                            <c:if test="${user.ecanvalidate == 'true'}" >
                                <form action="ServletTakeDecision">
                                    <input type="radio" name="valid" value="Validate" checked="checked" />Validate</input><br>
                                    <input type="radio" name="valid" value="Invalidate" checked="unchecked" />Invalidate</input><br><br>
                                    <textarea name="comment_txt" rows="4" cols="20">
                                            Comment On Decision
                                    </textarea>
                                    <input type="hidden" name="decisionid_hidden" value="${decision.did}" />
                                    <input type="submit" value="Take a decision" />
                                </form>
                            </c:if>

                            <%-- form for upload --%>

                            <form action="Servletupload" method="post" enctype="multipart/form-data" >
                                <table>
                                    <thead>
                                        <tr> 
                                            <th> <p class="text11boldwhite"> Add a new document on this step</p></th>
                                    </tr>
                                    </thead>
                                    <tr>
                                        <td>
                                            <p>Type of Document</p>
                                        </td>
                                        <td>
                                            <select name="doctypeselectd">
                                                <%
                                                    telechargertest tcore = new telechargertest();
                                                    List<Document> lstdoc = new ArrayList<Document>();
                                                    lstdoc = tcore.getAllDocument();
                                                    for (int i = 0; i < lstdoc.size(); i++) {
                                                        out.println("<option value=" + lstdoc.get(i).getDocid() + ">");
                                                        out.println(lstdoc.get(i).getDocid());
                                                        out.println(lstdoc.get(i).getDoctitle());
                                                        out.println("</option>");
                                                    }
                                                %>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><p>Title</p></td>
                                        <td> 
                                            <input type="text" name="title">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><p>Upload your file</p></td>
                                        <td>
                                            <input type="file" name="filename">
                                        </td>
                                    </tr>
                                </table>
                                <input type="hidden" name="empselectd" value="${user.eid}" />
                                <input type="hidden" name="decision" value="${decision.did}" />
                                <input  type="submit" value="Add this Document">
                                <input type="reset" value="Reset">
                            </form><br><br>



                            <%-- form for view table and download --%>                  
                            <c:if test="${not empty lstdocversion}">

                                <table border="0" cellspacing="5">
                                    <thead>
                                        <tr>
                                            <th><p class="text11boldwhite">Document link to the step validation</p></th>
                                    <th><p class="text11boldwhite">Upload by</p></th>
                                    <th> </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        <c:forEach var="docversion" items="${lstdocversion}">
                                            <tr>
                                                <td>
                                                    <p>${docversion.docvtitle}</p>
                                                </td>
                                                <td>
                                                    <p>${docversion.employee}</p>
                                                </td>
                                                <td>
                                                    <form  action="Servletdownload">
                                                        <input type="hidden" name="docvselected" value="${docversion.docvid}" />
                                                        <input type="submit" value="Download">
                                                    </form>
                                                </td>
                                            </tr>
                                        </c:forEach>
                                    </tbody>
                                </table>
                            </c:if>
                            <c:if test="${empty lstdocversion}" >No document for this decision</c:if>
                        </div>
                        <div class="right"></div>
                    </div>
                    </body>
                    </html>
